home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / clipper / nfsrc21.zip / PVID.PRG < prev    next >
Text File  |  1992-10-16  |  4KB  |  134 lines

  1. /*
  2.  * File......: PVID.PRG
  3.  * Author....: Ted Means
  4.  * CIS ID....: 73067,3332
  5.  * Date......: $Date:   16 Oct 1992 00:05:22  $
  6.  * Revision..: $Revision:   1.1  $
  7.  * Log file..: $Logfile:   C:/nanfor/src/pvid.prv  $
  8.  * 
  9.  * This is an original work by Ted Means and is placed in the
  10.  * public domain.
  11.  *
  12.  * Modification history:
  13.  * ---------------------
  14.  *
  15.  * $Log:   C:/nanfor/src/pvid.prv  $
  16.  * 
  17.  *    Rev 1.1   16 Oct 1992 00:05:22   GLENN
  18.  * Just making sure we had Ted's most current revision.
  19.  * 
  20.  *    Rev 1.0   22 Aug 1992 16:51:32   GLENN
  21.  * Initial revision.
  22.  */
  23.  
  24. #include "SET.CH"
  25.  
  26. #define PV_ROW     1
  27. #define PV_COL     2
  28. #define PV_COLOR   3
  29. #define PV_IMAGE   4
  30. #define PV_CURSOR  5
  31. #define PV_BLINK   6
  32. #define PV_NOSNOW  7
  33. #define PV_MAXROW  8
  34. #define PV_MAXCOL  9
  35. #define PV_SCORE  10
  36.  
  37. static aVideo := {}
  38.  
  39. /*  $DOC$
  40.  *  $FUNCNAME$
  41.  *     FT_PUSHVID()
  42.  *  $CATEGORY$
  43.  *     Video
  44.  *  $ONELINER$
  45.  *     Save current video states on internal stack.
  46.  *  $SYNTAX$
  47.  *     FT_PushVid() -> <nStackSize>
  48.  *  $ARGUMENTS$
  49.  *     None
  50.  *  $RETURNS$
  51.  *     The current size of the internal stack (i.e. the number of times
  52.  *     FT_PushVid() has been called).
  53.  *  $DESCRIPTION$
  54.  *     Menus, picklists, browses, and other video-intensive items often
  55.  *     require you to save certain video states -- screen image, cursor
  56.  *     position, and so forth.  Constantly saving and restoring these items
  57.  *     can get very tedious.  This function attempts to alleviate this
  58.  *     problem.  When called, it saves the cursor position, color setting,
  59.  *     screen image, cursor style, blink setting, scoreboard setting, snow
  60.  *     setting, and maximum row and column to a series of static arrays.  All
  61.  *     that is needed to restore the saved settings is a call to FT_PopVid().
  62.  *  $EXAMPLES$
  63.  *     FT_PushVid()          // Save the current video states
  64.  *  $SEEALSO$
  65.  *     FT_PopVid()
  66.  *  $END$
  67.  */
  68.  
  69. function FT_PushVid()
  70.  
  71. AAdd( aVideo, { row(), ;
  72.                 col(), ;
  73.                 setcolor(), ;
  74.                 savescreen( 0, 0, maxrow(), maxcol() ), ;
  75.                 set( _SET_CURSOR ), ;
  76.                 setblink(), ;
  77.                 nosnow(), ;
  78.                 maxrow() + 1, ;
  79.                 maxcol() + 1, ;
  80.                 set( _SET_SCOREBOARD ) } )
  81.  
  82. return len( aVideo )
  83.  
  84.  
  85.  
  86. /*  $DOC$
  87.  *  $FUNCNAME$
  88.  *     FT_POPVID()
  89.  *  $CATEGORY$
  90.  *     Video
  91.  *  $ONELINER$
  92.  *     Restore previously saved video states.
  93.  *  $SYNTAX$
  94.  *     FT_PopVid() -> <nStackSize>
  95.  *  $ARGUMENTS$
  96.  *     None
  97.  *  $RETURNS$
  98.  *     The number of items remaining in the internal stack.
  99.  *  $DESCRIPTION$
  100.  *     This is the complementary function to FT_PushVid().  At some time
  101.  *     after saving the video states it will probably be necessary to restore
  102.  *     them.  This is done by restoring the settings from the last call to
  103.  *     FT_PushVid().  The number of items on the internal stack is then
  104.  *     reduced by one.  Note that the use of stack logic means that items on
  105.  *     the stack are retrieved in Last In First Out order.
  106.  *  $EXAMPLES$
  107.  *     FT_PopVid()          // Restore video states
  108.  *  $SEEALSO$
  109.  *     FT_PushVid()
  110.  *  $END$
  111.  */
  112.  
  113. function FT_PopVid()
  114.  
  115. local nNewSize := len( aVideo ) - 1
  116. local aBottom  := ATail( aVideo )
  117.  
  118. if nNewSize >= 0
  119.    setmode( aBottom[ PV_MAXROW ], aBottom[ PV_MAXCOL ] ) 
  120.    set( _SET_CURSOR, aBottom[ PV_CURSOR ] )
  121.    nosnow( aBottom[ PV_NOSNOW ] )
  122.    setblink( aBottom[ PV_BLINK ] )
  123.    restscreen( 0, 0, maxrow(), maxcol(), aBottom[ PV_IMAGE ] )
  124.    setcolor( aBottom[ PV_COLOR ] )
  125.    setpos( aBottom[ PV_ROW ], aBottom[ PV_COL ] )
  126.    set( _SET_SCOREBOARD, aBottom[ PV_SCORE ] )
  127.  
  128.    aSize( aVideo, nNewSize )
  129. endif
  130.  
  131. return len( aVideo )
  132.  
  133.  
  134.